package com.example.testdemo.demos.web;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @ClassName: User
 * @Description:
 * @Date 2024/04/01 11:28
 * @Author songshaoqiu
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    public User(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    private Integer id;
    private String name;
    //单独使用@JsonFormat  入参的格式 必须相符。2024-11-11 01:02 对应这种也不会报错
    // 单独使用 DateTimeFormat  入参只能使用 get方法的入参

    // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date time;
}
